﻿#ifndef _OI_PLSCANNERCORE_COMMUNICATION_TASK_HPP_
#define _OI_PLSCANNERCORE_COMMUNICATION_TASK_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class OI_PLSCANNER_CORE_API ModbusCommTask : public QThread
        {
            Q_OBJECT

        public:
            ModbusCommTask();

            ~ModbusCommTask();

        public:
            void exit();

            void run();

            void quit();

        public:
            void write(int addr, int nb, ushort *data);

            void read(int addr, int nb, ushort* data);
            void readSignal(int addr, int nb, ushort* data);
        signals:
            void readCompleted(const QByteArray data);

            void writeCompleted();

        public:
            static ModbusCommTask* instance();

        private:
            OI_DISABLE_COPY(ModbusCommTask);
            OI_DECLARE_IMPL(ModbusCommTask);

        };

    }

}


#endif